<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>文本镂空效果</title>
    <style>
      * {
        padding: 0;
        margin: 0;
      }
      body {
        --bg: url("../assets//img/夜景.jpg") no-repeat center/cover;
        background: var(--bg);
        height: 100vh;
        font-family: "Open Sans", sans-serif;
      }
      /* 蒙层 */
      .middle {
        background: rgba(0, 0, 0, 0.7);
        height: 100%;
        width: 100%;
      }
      .middle h1 {
        width: 100%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 12vw;
        /* 文本阴影 */
        text-stroke: 1px #fff;
        -webkit-text-stroke: 1px #fff;
        background: var(--bg);
        /* 设置背景只覆盖文字 */
        background-clip: text;
        -webkit-background-clip: text;
        color: transparent;
      }
    </style>
  </head>
  <body>
    <!-- 蒙层 -->
    <div class="middle">
      <h1>微微地晚风</h1>
    </div>
  </body>
</html>
